package com.itlong.cloud.user.operate;

import com.itlong.cloud.POJO.DTO.operate.OperateRoleGetPageDTO;
import com.itlong.cloud.POJO.PO.OperateRolePO;
import com.itlong.cloud.utils.page.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * <desc>
 *      运营-角色管理业务处理暴露接口
 * </desc>
 *
 * @createDate 2017/09/25
 */
@FeignClient(name = "user-service")
public interface IOperateRoleServiceClient {
    /**
     * <desc>
     *      获取分页列表
     * </desc>
     *
     * @param operateRoleGetPageDTO 查询参数DTO
     * @return page模型
     * @author Jiaqi.X
     * @createDate 2017/09/25
     */
    @RequestMapping(path = "/operate/system/role/getPage")
    Page<OperateRolePO> getPage(@RequestBody OperateRoleGetPageDTO operateRoleGetPageDTO) throws Exception;

    /**
     * <desc>
     *      保存角色
     * </desc>
     *
     * @param operateRolePO 角色实体
     * @return sql执行行数
     * @author Jiaqi.X
     * @createDate 2017/09/25
     */
    @RequestMapping(path = "/operate/system/role/save")
    Integer save(@RequestBody OperateRolePO operateRolePO) throws Exception;

    /**
     * <desc>
     *      更新角色
     * </desc>
     *
     * @param operateRolePO 角色实体
     * @return sql执行行数
     * @author Jiaqi.X
     * @createDate 2017/09/25
     */
    @RequestMapping(path = "/operate/system/role/update")
    Integer update(@RequestBody OperateRolePO operateRolePO) throws Exception;

    /**
     * <desc>
     *      查询单个角色
     * </desc>
     *
     * @param operateRolePO 角色实体
     * @return 角色实体
     * @author Jiaqi.X
     * @createDate 2017/09/25
     */
    @RequestMapping(path = "/operate/system/role/getOne")
    OperateRolePO getOne(@RequestBody OperateRolePO operateRolePO);

    /**
     * <desc>
     *      删除角色
     * </desc>
     *
     * @param roleIds 角色id数组
     * @return sql执行行数
     * @author Jiaqi.X
     * @createDate 2017/09/25
     */
    @RequestMapping(path = "/operate/system/role/delete")
    Integer delete(@RequestParam("roleIds")String roleIds) throws Exception;

    /**
     * <desc>
     *      保存角色菜单
     * </desc>
     *
     * @param roleId 角色id
     * @param functionIds 资源id 多个,号分隔
     * @return
     * @author Jiaqi.X
     * @version 1.0
     */
    @RequestMapping(path = "/operate/system/role/saveRoleFunction")
    Integer saveRoleFunction(@RequestParam("roleId")String roleId,
                             @RequestParam(value = "functionIds",required = false)String functionIds,
                             @RequestParam(value = "assessFunctionIds",required = false) String assessFunctions,
                             @RequestParam("myUserName") String myUserName) throws Exception;

    /**
     * <desc>
     *      获取所有角色
     * </desc>
     *
     * @return
     * @author Jiaqi.X
     * @createDate 2017/09/29
     */
    @RequestMapping(path = "/operate/system/role/getList")
    List<OperateRolePO> getList(@RequestParam("userId") String userId);

    /**
     * <desc>
     *       为角色分配人员
     * </desc>
     *
     * @param roleId    角色id
     * @param allotUsers    需要分配的人员id 多个，号分隔
     * @param userIds 当前列表所有人员id 多个，号分隔
     * @return sql执行行数
     * @author Jiaqi.X
     * @createDate 2017/10/10
     */
    @RequestMapping(path = "/operate/system/role/saveRoleUsers")
    Integer saveRoleUsers(
                @RequestParam("roleId")String roleId,
                @RequestParam(value = "allotUsers",required = false)String allotUsers,
                @RequestParam("userIds")String userIds) throws Exception;

    /**
     * <desc>
     *      判断角色名是否已存在
     * </desc>
     *
     * @param roleName 角色名称
     * @return
     * @author Jiaqi.X
     * @createDate 2017/12/25
     */
    @RequestMapping(path = "/operate/system/role/checkRoleNameExist")
    Integer checkRoleNameExist(@RequestParam("roleName") String roleName);
}
